#include "pub_defs.h"

/**
 * @brief baseline
 * @param x position array
 * @param v velocity array
 * @param n number of bodies
 * @param tmax number of time periods
 * @param m mass of each body
 * @param dt time step
*/
void calc_xv_baseline(TD* x, TD* v, int n, int tmax, double m, double dt) {
    int t,i;
    TD F;
    TD* vnew = new TD[n];
    TD* xnew = new TD[n];
    
    for (t = 0; t < tmax; t++) { /*for each time period*/ 
        for (i = 0; i < n; i++) { 
            /*for each body*/ 
            F = F_routine(i); 
            /*compute F on ith body*/ 
            vnew[i] = v[i] + F * dt / m; /*compute new velocity and*/
            xnew[i] = x[i] + vnew[i] * dt; /*new position */ 
        } 
        for (i = 0; i < n; i++) { 
            /*for each body*/ 
            x[i] = xnew[i]; 
            /*update velocity and position*/ 
            v[i] = vnew[i]; 
        }
    }
}